const mongoose = require('mongoose');
const addressSchema = new mongoose.Schema({
    default:            {type: Boolean,default:false},
    name:               {type: String,default:''},
    ads_phone:          {type: String,default:''},
    province:           {type: String,default:''},
    city:               {type: String,default:''},
    area:               {type: String,default:''},
    town:               {type: String,default:''},
    street:             {type: String,default:''},
    detail:             {type: String,default:''},
    address_crood:      {type: String,default: ''},//地址坐标

})

const schema = new mongoose.Schema({
    phone:          {type: String},
    password:       {type: String},
    role:           {type: String,default: 'user'},
    frozen:         {type: Boolean,default: false},
    name:           {type: String,default: ''},
    gender:         {type: String,default: 1},
    portrait_url:   {type: String,default: '123.jpg'},//头像
    account:        {type: Number,default: 0},
    credits:        {type: Number,default: 0},
    money:          {type: Number,default: 0},
    sign:           {type: String,default: ''},
    user:{
        honor:      {type: String,default: '青铜'},
        ticket:     {type: String,default: ''},
        address:    [addressSchema],
        order:      {type: Array}
    },
    collector:{
        work_city:      {type: String,default:''},
        work_area:      {type: String,default:''},
        proceed_code:   {type: String,default: ''},
        order:          {type: Array}
    }
})
module.exports = mongoose.model('Roles',schema);